﻿using AnyLink.Domain.Enums;
using Newtonsoft.Json;
using SqlSugar;

namespace AnyLink.Domain.Entities.System
{
    /// <summary>
    /// 系统访问记录
    /// </summary>
    [SugarTable("sys_logininfor", TableDescription = "系统访问记录", IsDisabledUpdateAll = true)]
    public class SysLogininfor : IPrimaryKeyEntity<long>
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true,  ColumnName = "info_id", ColumnDescription = "访问ID")]
        [JsonProperty(propertyName: "infoId")]
        public long Id { get; set; }   

        /// <summary>
        /// 登录账号
        /// </summary>
        [SugarColumn(ColumnName = "login_name", ColumnDataType = "VARCHAR(50)", ColumnDescription = "登录账号", IsNullable = true)]
        public string LoginName { get; set; }

        /// <summary>
        /// 登录IP地址
        /// </summary>
        [SugarColumn(ColumnName = "ipaddr", ColumnDataType = "VARCHAR(128)", ColumnDescription = "登录IP地址", IsNullable = true)]
        public string Ipaddr { get; set; }

        /// <summary>
        /// 登录地点
        /// </summary>
        [SugarColumn(ColumnName = "login_location", ColumnDataType = "VARCHAR(255)", ColumnDescription = "登录地点", IsNullable = true)]
        public string LoginLocation { get; set; }

        /// <summary>
        /// 浏览器类型
        /// </summary>
        [SugarColumn(ColumnName = "browser", ColumnDataType = "VARCHAR(50)", ColumnDescription = "浏览器类型", IsNullable = true)]
        public string Browser { get; set; }

        /// <summary>
        /// 操作系统
        /// </summary>
        [SugarColumn(ColumnName = "os", ColumnDataType = "VARCHAR(50)", ColumnDescription = "操作系统", IsNullable = true)]
        public string Os { get; set; }

        /// <summary>
        /// 登录状态（0成功 1失败）
        /// </summary>
        [SugarColumn(ColumnName = "status", ColumnDescription = "登录状态（0成功 1失败）", IsNullable = true)]
        public StatusEnum Status { get; set; }

        /// <summary>
        /// 提示消息
        /// </summary>
        [SugarColumn(ColumnName = "msg", ColumnDataType = "VARCHAR(255)", ColumnDescription = "提示消息", IsNullable = true)]
        public string Msg { get; set; }

        /// <summary>
        /// 访问时间
        /// </summary>
        [SugarColumn(ColumnName = "login_time", ColumnDescription = "访问时间", IsNullable = true)]
        public DateTime LoginTime { get; set; }
    }
}